﻿namespace Common
{
    /// <summary>
    /// 错误信息
    /// </summary>
    public interface IPromptInfo
    {
        /// <summary>
        /// 错误代码
        /// </summary>
        int Code { get; }
        /// <summary>
        /// 自定义信息
        /// </summary>
        string CustomMessage { get; }
        /// <summary>
        /// 自定义信息
        /// </summary>
        string CustomMessageStack { get; }
        /// <summary>
        /// 内部错误
        /// </summary>
        IPromptInfo InnerPromptInfo { get; }
        /// <summary>
        /// 生成的错误消息
        /// </summary>
        string Message { get; }
        /// <summary>
        /// 生成的错误消息
        /// </summary>
        string MessageStack { get; }
        /// <summary>
        /// 错误类型
        /// </summary>
        ResultType ResultType { get; set; }
        /// <summary>
        /// 上报错误
        /// </summary>
        /// <param name="restulType"></param>
        void Alert(ResultType restulType);
        /// <summary>
        /// 上报错误
        /// </summary>
        /// <param name="restulType"></param>
        /// <param name="innerPromptInfo"></param>
        void Alert(ResultType restulType, IPromptInfo innerPromptInfo);
        /// <summary>
        /// 上报错误
        /// </summary>
        /// <param name="restulType"></param>
        /// <param name="message"></param>
        void Alert(ResultType restulType, string message);
        /// <summary>
        /// 上报错误
        /// </summary>
        /// <param name="restulType"></param>
        /// <param name="message"></param>
        /// <param name="innerPromptInfo"></param>
        void Alert(ResultType restulType, string message, IPromptInfo innerPromptInfo);
        /// <summary>
        /// 上报错误
        /// </summary>
        /// <param name="message"></param>
        void Alert(string message);
        /// <summary>
        /// 上报错误
        /// </summary>
        /// <param name="message"></param>
        /// <param name="innerPromptInfo"></param>
        void Alert(string message, IPromptInfo innerPromptInfo);
        /// <summary>
        /// 转换为FuncResult对象
        /// </summary>
        /// <param name="defaultMessage"></param>
        /// <returns></returns>
        FuncResult AsFailResult(string defaultMessage = null);
        /// <summary>
        /// 转换为FuncResult对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="defaultMessage"></param>
        /// <returns></returns>
        FuncResult<T> AsFailResult<T>(string defaultMessage = null);
    }
}